/*
 * @(#)AbstractTransformer.java
 * Date 2013-09-24
 * Version 1.0
 * Author Jim Horner
 * Copyright (c)2012
 */


package us.hornerscorners.lamppost.transformer;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import us.hornerscorners.lamppost.exception.ServiceActionException;


/**
 * Class description
 *
 *
 * @param <X>
 * @param <Y>
 *
 * @version        v1.0, 2013-09-24
 * @author         Jim Horner
 */
public abstract class AbstractTransformer<X, Y> implements ITransformer<X, Y> {

    /**
     * Constructs ...
     *
     */
    public AbstractTransformer() {
        super();
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public Class getErrorLocation() {
        return getClass();
    }

    /**
     * Method description
     *
     *
     * @param inputs
     *
     * @return
     * @throws us.hornerscorners.lamppost.exception.ServiceActionException
     *
     */
    @Override
    public Collection<Y> transform(Collection<? extends X> inputs)
            throws ServiceActionException {

        List<Y> result = new ArrayList<>();

        for (X input : inputs) {
            result.add(transform(input));
        }

        return result;
    }
}
